package org.example.apply.utils;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class ResultJson<T> {

    private int code;
    private String msg;
    private T data;

    public static ResultJson fail(){
        return new ResultJson(500,null,null);
    }
    public static ResultJson fail(int errCode){
        return new ResultJson(errCode,null,null);
    }
    public static ResultJson fail(int errCode,String msg,Object data){
        return new ResultJson(errCode,msg,data);
    }

    public static ResultJson success(String msg,Object data){//成功返回 带数据
        return new ResultJson(200,msg,data);
    }

    public static ResultJson success(Object data){//成功返回 带数据
        return new ResultJson(200,null,data);
    }
    public static ResultJson success(String msg){//成功返回 带字符串
        return new ResultJson(200,msg,null);
    }
    public static ResultJson success(){//成功返回
        return new ResultJson(200,null,null);
    }

}
